package com.jzj.dao.impl;

import com.jzj.dao.BaseDao;
import com.jzj.entity.Shop;
import com.mysql.cj.protocol.Resultset;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;


public class All extends BaseDao {
    public List xianshi() {
        getConnection();
        List<Shop> list = new ArrayList();
        try {
            ResultSet resultSet = selectSql("SELECT sp.id,sp.name,sp.in_price,sp.price,sp.count,st.name as status FROM shop sp INNER JOIN state st WHERE sp.status=st.id" );
            while (resultSet.next()) {
                int id =resultSet.getInt("id");
                String name=resultSet.getString("name");
                double in_price=resultSet.getDouble("in_price");
                double price=resultSet.getDouble("price");
                int count=resultSet.getInt("count");
                String status=resultSet.getString("status");
                list.add(new Shop(id,name,in_price,price,count,status));
            }
            closeConnection();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }finally {
            return list;
        }
    }
   /* public boolean findSql(Object sql[]){
        getConnection();
        try {
            ResultSet resultSet = selectSql("select from shop where name=?",sql);
            if(resultSet==null){
                return false;
            }
        }catch (Exception e){
            e.printStackTrace();
        }finally {

        }
        return true;
    }*/
    public void updateSql(Shop shop){
        getConnection();
        String sql="updata";

    }








}
